home *** CD-ROM | disk | FTP | other *** search
/ Best Tools for JAVA / Best Tools for JAVA.iso / JAVA_ALL / IDE / SUBARTIC / SUB_ARCT / INPUT / PICK_COL.JAV < prev    next >
Encoding:
Text File  |  1996-10-04  |  3.5 KB  |  108 lines

  1. package sub_arctic.input;
  2.  
  3. import sub_arctic.lib.interactor;
  4.  
  5. import java.util.Vector;
  6.  
  7. /** 
  8.  * Object for building and holding a set of interactor objects picked by
  9.  * a point.  This class maintains an ordered list of "user_info_holder" 
  10.  * objects each of which represents an interactor object along with optional 
  11.  * user information that interactor has saved about the details of the pick.
  12.  * This user information is passed back to object when input is delivered to
  13.  * them.
  14.  *
  15.  * @author Scott Hudson
  16.  */
  17. public class pick_collector {
  18.  
  19.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  20.  
  21.   /** Internal Vector to hold our picked objects.  This holds 
  22.    *  user_info_holder objects. */
  23.   protected Vector _pick_list;
  24.  
  25.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  26.  
  27.   /** Simple constructor */
  28.   public pick_collector()
  29.     {
  30.       _pick_list = new Vector();
  31.     }
  32.  
  33.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  34.  
  35.   /** Total number of picks we currently have. */
  36.   public int num_picks() { return _pick_list.size(); } 
  37.  
  38.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  39.  
  40.   /** 
  41.    * Retrieve the ith user_info_holder object from the current collection 
  42.    * of picks. 
  43.    *
  44.    * @param int indx index of object we want.
  45.    * @return user_info_holder the object at that index.
  46.    */
  47.   public user_info_holder pick(int indx)
  48.     {
  49.       return (user_info_holder)_pick_list.elementAt(indx);
  50.     }
  51.  
  52.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  53.  
  54.   /** 
  55.    * Add the given object (with optional additional information) to the 
  56.    * end of the current pick collection.
  57.    *
  58.    * @param interactor in_obj    the object being added as a pick. 
  59.    * @param Object     user_info uninterpreted user information to be 
  60.    *                             associated with that object and returned to 
  61.    *                             it when input associated with this pick is 
  62.    *                             delivered to it.
  63.    */
  64.   public void report_pick(interactor in_obj, Object user_info)
  65.     {
  66.       _pick_list.addElement(new user_info_holder(in_obj,user_info));
  67.     }
  68.  
  69.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  70.  
  71.   /** 
  72.    * Add the given object to the end of the current pick collection.  The
  73.    * optional user information associated with the pick will be set to null.
  74.    *
  75.    * @param interactor in_obj    the object being added as a pick. 
  76.    */
  77.   public void report_pick(interactor in_obj)
  78.     {
  79.       _pick_list.addElement(new user_info_holder(in_obj,null));
  80.     }
  81.  
  82.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  83.  
  84.   /** Reset the pick collection to empty. */
  85.   public void reset()
  86.     {
  87.       _pick_list.removeAllElements();
  88.     }
  89.  
  90.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  91. }
  92. /*=========================== COPYRIGHT NOTICE ===========================
  93.  
  94. This file is part of the subArctic user interface toolkit.
  95.  
  96. Copyright (c) 1996 Scott Hudson and Ian Smith
  97. All rights reserved.
  98.  
  99. The subArctic system is freely available for most uses under the terms
  100. and conditions described in 
  101.   http://www.cc.gatech.edu/gvu/ui/sub_arctic/sub_arctic/doc/usage.html 
  102. and appearing in full in the lib/interactor.java source file.
  103.  
  104. The current release and additional information about this software can be 
  105. found starting at: http://www.cc.gatech.edu/gvu/ui/sub_arctic/
  106.  
  107. ========================================================================*/
  108.